{% set pypi_name = 'python-watcherclient' %}
{% set upstream_version = upstream_version('3.1.1') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Epoch:          {{ epoch('python-watcherclient') }}
Summary:        Python API and CLI for OpenStack Watcher
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('PyYAML') }}
BuildRequires:  {{ py3('cliff') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('keystoneauth1') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('osc-lib') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testtools') }}
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('cliff') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('six') }}
BuildArch:      noarch

%description
Client library for Watcher built on the Watcher API. It provides a Python API
(the watcherclient module) and a command-line tool (watcher).

%package -n python3-watcherclient
Summary:        Python API and CLI for OpenStack Watcher
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('cliff') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('six') }}

%description -n python3-watcherclient
Client library for Watcher built on the Watcher API. It provides a Python API
(the watcherclient module) and a command-line tool (watcher).

This package contains the Python 3.x module.

%package -n python-watcherclient-doc
Summary:        Documentation for OpenStack Watcher API client libary
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description -n python-watcherclient-doc
Client library for Watcher built on the Watcher API. It provides a Python API
(the watcherclient module) and a command-line tool (watcher).
This package contains the documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

# Build HTML docs and man page
PYTHONPATH=. PBR_VERSION={{ upstream_version }} %sphinx_build -b html -d doc/build/doctrees doc/source doc/build/html
rm -fr doc/build/html/.doctrees doc/build/html/.buildinfo

%install
%{py3_install}

%check
export TEST_PATH=./watcherclient/tests/unit
python3 -m stestr.cli run

%files -n python3-watcherclient
%doc README.rst
%license LICENSE
%{python3_sitelib}/watcherclient
%{python3_sitelib}/*.egg-info
%{_bindir}/watcher

%files -n python-watcherclient-doc
%doc doc/build/html
%license LICENSE

%changelog
